package extend.函数式接口;

import java.util.Arrays;
import java.util.Comparator;
import java.util.function.Consumer;

public class TestSort {
    //借助于Arrays.sort() 来实现我的函数式接口
    public static void main(String[] args) {
        MySort mySort = Arrays::sort;
        int[] arr = {5, 3, 1, 2, 4};
        mySort.sort(arr);
        System.out.println(Arrays.toString(arr));

        MyString myString =TestSort::concat;
        System.out.println(myString.concat("hello ", "world"));
    }

    public static String concat(String a, String b) {
        return a + b;
    }
}

interface MySort {
    void sort(int[] arr);
}

interface MyString {
    String concat(String a, String b);
}
